package com.xiton.customer.controller;

import com.xiton.customer.feignclient.ProductClient;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

@RestController
public class CustonmerController {

    private static final Logger log = LoggerFactory.getLogger(CustonmerController.class);
    @Autowired
    private RestTemplate restTemplate;

    @Autowired
    private ProductClient productClient;

    @GetMapping("/customer")
    public String getCus() {

//        String forObject = restTemplate.getForObject("http://GOOD/getGood", String.class);
        String forObject = productClient.getGoods(2);
        log.info("商品服务调用结果" + forObject);
        return forObject;
    }
}
